<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

function anchor_image($uri = '', $title = '', $attributes = '')
{
	if ( ! is_array($uri))
	{
		$site_url = ( ! preg_match('!^\w+://!i', $uri)) ? site_url($uri) : $uri;
	}
	else
	{
		$site_url = site_url($uri);
	}
	
	if ($title == '')
	{
		$title = $site_url;
	}

	return '<a href="'.$site_url.'"'.$attributes.'>'.$title.'</a>';
}
	

# /var/www/public/img/icon/32x32/emblems
# /var/www/public/img/icon/32x32/devices/camera-photo.png
include_once('tystring_helper.php');
function anchor_icon($uri, $image, $title = FALSE)
{
    $site_url = site_url($uri);
    $dir  = rstrstr($image, '/');
    $name = stristr($image, '/');
    if($title == FALSE){
        #$title = str_replace('_',' ', $name);
        $title = str_replace('-',' ', $name);
        $title = stristr($title, ' ');
        $title = ucwords($title); // Upper case words
    }
	$img = '<img src="/public/img/icon/32x32/'.$image.'.png"  alt="'.$title.'" />';
    return '<a href="'.$site_url.'">'.$img.'</a>';
}


function delete_icon($url)
{
    
    $img = '<img class="icon" src="/public/img/icon/delete.gif" alt="Delete" />';
    return '<a href="'.$url.'">'.$img.'</a>';
}

function edit_icon($url)
{
    $img = '<img class="icon" src="/public/img/icon/edit.gif" alt="Edit" />';
    return '<a href="'.$url.'">'.$img.'</a>';
}
?>
